<template>
  <div>
    <p>表格（可开启编辑）</p>
    <an-table :rows="tableList" :structure="columns" @setValue="setValue"/>
  </div>
</template>

<script>
import anTable from '@/an-ui/an-table'
export default {
  name: 'my-table',
  data () {
    return {
      tableList: [
        {name: '刘志超', age: '21', sex: '男', like: 'LOL'},
        {name: '刘二蛋', age: '18', sex: '女', like: 'bilibili'},
        {name: '赵铁柱', age: '30', sex: '男', like: 'zhihu'}
      ],
      columns: [
        {title: '姓名', key: 'name', readonly: true},
        {title: '年龄', key: 'age', readonly: true},
        {title: '性别', key: 'sex'},
        {title: '爱好', key: 'like'}
      ]
    }
  },
  methods: {
    setValue ({value, row}) {
      console.log(value, row)
    }
  },
  components: {
    anTable
  },
  created () {
  }
}
</script>

<style scoped>

</style>
